
public class Video {
    private String title;
    private int length;

    public Video(String title, int length) {
	setTitle(title);
	setLength(length);
    }

    public void setTitle(String title) {
	if (title == null)
	    throw new IllegalArgumentException("null title");
	this.title = title;
    }

    public String getTitle() {
	return title;
    }

    public void setLength(int length) {
	if (length < 0)
	    throw new IllegalArgumentException("negative length");
	this.length = length;
    }

    public int getLength() {
	return length;
    }

    public String toString() {
	return "Video: title: " + title + " length: " + length;
    }

    public boolean equals (Object rhs) {
	if (rhs instanceof Video) {
	    Video v = (Video)rhs;
	    return title.equals(v.title) && length == v.length;
	}
	return false;
    }
}
